<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<title>{yun:}$title{/yun} - 手机人才网</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width" initial-scale="1"/>
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width"/>
<link rel="stylesheet" href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/css.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
<link rel="stylesheet" href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/job.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
<link rel="stylesheet" href="{yun:}$config.sy_weburl{/yun}/app/template/wap/css/map.css?v={yun:}$config.cachecode{/yun}" type="text/css"/>
</head>
<body>
<div id="allmap"></div>
<div class="jobmap_box_footer">
	<div class="jobmap_box">
	<div class="jobmap_comname">{yun:}$com.name{/yun}</div>  
    <div class="jobmap_comsdd">{yun:}$com.address{/yun}  </div>  
	</div>
	<div class="jobmap_box_look">
	<a href="javascript:void(0);" onclick="way('{yun:}$com.name{/yun}','{yun:}$cityname{/yun}')">查看路线</a>  
	</div>
</div>
<input type="hidden" id="map_x" value="{yun:}$mapx{/yun}"/>
<input type="hidden" id="map_y" value="{yun:}$mapy{/yun}"/>
<style type="text/css">
	#allmap {width: 100%;height: 80%;overflow: hidden;margin:0;}
</style>
<script src="{yun:}$config.sy_weburl{/yun}/app/template/wap/js/prefixfree.min.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/app/template/wap/js/layer/layer.m.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/app/template/wap/js/public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script> 
<script type="text/javascript" src="{yun:}$config.mapurl{/yun}"></script> 
<script type="text/javascript">
	var wapurl = '{yun:}url m=wap{/yun}';
	// 百度地图API功能
	var x = '{yun:}$com.x{/yun}';
	var y = '{yun:}$com.y{/yun}';
	var map = new BMap.Map("allmap");
	var point = new BMap.Point(x, y);
	map.centerAndZoom(point, 15);
	var marker = new BMap.Marker(point);  // 创建标注
	map.addOverlay(marker);               // 将标注添加到地图中

	var map_x = $("#map_x").val();
	var map_y = $("#map_y").val();
	setTimeout(function(){
		if(map_x==0 && map_y==0){
			var geolocation = new BMap.Geolocation();
			geolocation.getCurrentPosition(function (r) {
				if (this.getStatus() == BMAP_STATUS_SUCCESS) {
					$.post(wapurl+'index.php?c=job&a=distance',{x:r.point.lng,y:r.point.lat},function(data){})
					$("#map_x").val(r.point.lng);
					$("#map_y").val(r.point.lat); 
				}
				else {
					if (this.getStatus() == "6") {
						layermsg("开启手机定位后才能使用此功能",2);return false;
					}else if (this.getStatus() == "7") {
						layermsg("开启手机定位后才能使用此功能",2);return false;
					}else {
						layermsg("地图定位出错",2);return false;
					}
				}
			}, { enableHighAccuracy: true })
		}
	},1000);

	function way(name,cityname){
		var map_x=$("#map_x").val(),map_y=$("#map_y").val();
		if(map_x>0 && map_y>0){
			location.href = 'https://api.map.baidu.com/direction?origin=latlng:' + parseFloat(map_y).toFixed(5) + ',' + parseFloat(map_x).toFixed(5) + '|name:当前位置&destination=latlng:' + parseFloat(y).toFixed(5) + ',' + parseFloat(x).toFixed(5) + '|name:'+ name +'&mode=driving&region='+ cityname +'&output=html';
		}else{
			layermsg('正在定位中，请稍候！');
		}
	}
</script> 
</body>
</html>